(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/Fly.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, '8b9c5S2XcFJMYw/AEe29uAE', 'Fly', __filename);
// script/Fly.js

"use strict";

/**
 * 纸飞机
 */
cc.Class({
    extends: cc.Component,

    properties: {
        player: cc.Node
    },

    // onLoad () {},

    start: function start() {
        this.playerRig = this.player.getComponent(cc.RigidBody);
        this.playerPhysicsBox = this.player.getComponent(cc.PhysicsBoxCollider);
    },


    onBeginContact: function onBeginContact(contact, selfCollider, otherCollider) {
        //纸飞机
        if (this.player.model === "Land" && otherCollider.tag === 88) {
            this.player.model = "Sky";
            this.player.prop = "uplift";
            this.playerRig._b2Body.m_gravityScale = 0.1;
            this.player.getComponent(cc.Animation).stop();
            this.player.getComponent(cc.Sprite).spriteFrame = cc.vv.res["Plane"];
            // this.playerPhysicsBox.offset.y = 0;
            // this.playerPhysicsBox.apply();
            // this.playerRig.fixedRotation = false;
            //this.playerRig._b2Body.m_linearVelocity.y = 0;
        } else if (this.player.model === "Sky" && otherCollider.tag === 88) {
            //陆地
            this.player.model = "Land";
            this.player.prop = "Jump";
            this.player.getComponent(cc.Sprite).spriteFrame = cc.vv.res["jump"];
            // this.playerPhysicsBox.offset.y = 27;
            // this.playerPhysicsBox.apply();
            this.playerRig._b2Body.m_linearVelocity.y = 0;
            this.playerRig._b2Body.m_linearVelocity.x = 5;
            this.playerRig._b2Body.m_gravityScale = 3;
            this.playerRig.fixedRotation = true;
            selfCollider.node.getComponent(cc.RigidBody).enabledContactListener = false;
        }
    }
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=Fly.js.map
        